<div id="main">

<?php
$hostname_logon = 'localhost';      //Database server LOCATION
    $database_logon = 'wwwmsc_newcareer';       //Database NAME
    $username_logon = 'wwwmsc';       //Database USERNAME
    $password_logon = 'Slpnxhe}bX4h';       //Database PASSWORD
	$database_connection = mysql_connect($hostname_logon,$username_logon,$password_logon) or die("couldnt connect with mysql");
	$database_selection = mysql_select_db($database_logon,$database_connection);
	mysql_query( "SET NAMES utf8", $database_connection );
        mysql_query( "SET CHARACTER SET utf8", $database_connection );
 $user_id="";
if($_REQUEST['submit_email'])
{
 $select="select * from USERS where user_email='".$_REQUEST['email']."'";
$result=mysql_query($select)or die(mysql_error());
$num_rows=mysql_num_rows($result);
if($num_rows > 0)
{
$row=mysql_fetch_array($result);
$user_id=$row['user_id'];
}else{
echo "Email Id is not associated with any account";
}
}
if(isset($_REQUEST['submit_pass']))
{
if(strlen($_REQUEST['pass']) < 7){
echo "You password should have 7 to 15 characters";
}else{

		if($_REQUEST['user_id']!="" && $_REQUEST['pass']!="")
		{
		 $update="update USERS set user_passwd='".md5($_REQUEST['pass'])."' where user_id='".$_REQUEST['user_id']."'";
		mysql_query($update);
		echo "Your Password Change Successfully";
		}else{
		echo "Please enter password";
		}
}
}
?>
<?php if($user_id!="")
{?>

<form action="portal.php?action=forgot" method="post">
<input type="hidden" name="user_id" value="<?php echo $user_id;?>">
Enter New Password : <input type="password" name="pass" id="pass" required ><br>
<input type="submit" name="submit_pass" id="subumit">

</form>
<? }else{?>
<form action="portal.php?action=forgot" onSubmit="javascript:return check_validation_error();" method="post">
Email : <input type="text" name="email" id="email" required ><br>
<input type="submit" name="submit_email" id="subumit">

</form>
<? }?>

    
</div>